import axios from 'axios';
import { message } from 'antd';
//http://localhost:3000/api http://localhost:80/api
const Config = {
  notLoginRoute: ['login'], // 无需登录即可访问的路由 name,
  baseURL: 'http://59.110.71.99:80/api',
  realUrl: 'http://59.110.71.99:8080/',
  isDev: false,
  baseWebSocketUrl: 'ws://59.110.71.99:8080/webSocket/',
};
let RouterMaper = new Map();
let ApiMaper = new Map();
let XKLYmap = new Map();
let JFKMmap = new Map();
let XZmap = new Map();
let SYFXmap = new Map();
let GXMSmap = new Map();

axios
  .get(Config.baseURL + '/dict/getInstrumentDict')
  .then(dict => {
    let res5 = dict.data;
    if (res5.code === 1) {
      let data = res5.data;
      console.log(data);
      for (let val in data[0]) {
        JFKMmap.set(val, data[0][val]);
      }
      for (let val in data[1]) {
        XZmap.set(val, data[1][val]);
      }
      for (let val in data[2]) {
        SYFXmap.set(val, data[2][val]);
      }
      for (let val in data[3]) {
        XKLYmap.set(val, data[3][val]);
      }
      for (let val in data[4]) {
        GXMSmap.set(val, data[4][val]);
      }
    } else if (res5.code >= 10000) {
      message.error('获取管理人列表出错，错误信息： ' + res5.message, 2);
    }
  })
  .catch(error => {
    console.log(error);
    message.error('获取字典列表出错，请联系后台', 2);
  });

RouterMaper.set('Register', '仪器录入');
RouterMaper.set('Examine', '仪器审核');
RouterMaper.set('Revise', '仪器修改');
RouterMaper.set('DePermission', '角色权限');
RouterMaper.set('UserManager', '用户管理');
RouterMaper.set('DeConfig', '系统配置');
RouterMaper.set('MyRegister', '录入记录');
RouterMaper.set('InData', '仪器信息及查询');
RouterMaper.set('InSheet', '仪器统计');
RouterMaper.set('InBatch', '仪器导入');
RouterMaper.set('InPresent', '仪器统计');
RouterMaper.set('ModelMake', '模型制作');
RouterMaper.set('MyRevise', '修改记录');
RouterMaper.set('Delete', '仪器删除');
RouterMaper.set('MyDelete', '删除记录');
RouterMaper.set('UserBatch', '用户导入');
RouterMaper.set('SaleInfo', '销售信息');
RouterMaper.set('ModelPlay', '模型场景播放');
RouterMaper.set('ProcessManager', '审核流程设置');
RouterMaper.set('DataDict', '数据字典');
RouterMaper.set('ExamineHis', '审核历史');

ApiMaper.set('role:delete', '角色删除');
ApiMaper.set('role:edit', '角色编辑');
ApiMaper.set('role:add', '角色添加');
ApiMaper.set('user:edit', '用户编辑');
ApiMaper.set('user:delete', '用户删除');
export { RouterMaper, ApiMaper, XKLYmap, JFKMmap, XZmap, SYFXmap, GXMSmap };
export default Config;
